package xyz.itpath.gen.util;

import java.util.regex.Pattern;

/**
 * @author zhaom
 * @date 2021/11/3 - 8:52
 * <p>
 * 字母工具
 */
public class AlphabetUtils {

    private final static Pattern PAT_NUMBER = Pattern.compile("[0-9]");
    private final static Pattern PAT_LETTER = Pattern.compile("[a-zA-Z]");
    private final static Pattern PAT_LITERAL = Pattern.compile("[a-zA-Z0-9]");
    private final static Pattern PAT_OPERATION = Pattern.compile("[+-\\\\*/]");

    public static boolean isNumber(Character c) {
        return PAT_NUMBER.matcher(c + "").matches();
    }

    public static boolean isLetter(Character c) {
        return PAT_LETTER.matcher(c + "").matches();
    }

    public static boolean isLiteral(Character c) {
        return PAT_LITERAL.matcher(c + "").matches();
    }

    public static boolean isOperation(Character c) {
        return PAT_OPERATION.matcher(c + "").matches();
    }

}
